﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.ComponentModel;

namespace Axe.ComponentModel
{

    public class YesNoTypeConverter : BooleanConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context,
          CultureInfo culture,
          object value,
          Type destType)
        {
            return YesNoResources.ResourceManager.GetString(value.ToString(), culture);
        }

        public override object ConvertFrom(ITypeDescriptorContext context,
          CultureInfo culture,
          object value)
        {
            return (string)value == YesNoResources.ResourceManager.GetString(true.ToString(), culture);
        }
    } 
}
